package org.yray.tts.media;

import org.yray.tts.dic.Segmenter;
import org.yray.tts.dic.StopWordDict;

import java.nio.ByteBuffer;
import java.util.List;

public class MediaStoreFactory {

    public static IMediaStore mediaStore711=new MediaStore8K();
    public static IMediaStore mediaStore8K=new MediaStore8K();
    public static byte[] toByte(String text,int type)
    {
        List<String> sentenceList= Segmenter.sentenceProcess(0L,text);
        MediaByteBuf byteBuf=new MediaByteBuf(type);
        for(String sentence:sentenceList)
        {
            MediaByte mediaByte= type==711? mediaStore711.toByte(sentence):mediaStore8K.toByte(sentence);
            byteBuf.add(mediaByte);
        }
        return byteBuf.combine(20);
    }
}
